package y2015.day_10.水果_简单工厂;

public class FruitFactory {
    public final static int APPLE = 1;
    public final static int GRAPE = 2;
    public final static int BANANA = 3;

    public static Fruit creat(int type) {
        Fruit fruit = null;
        switch (type) {
            case APPLE:
                fruit = new Apple();
                break;
            case GRAPE:
                fruit = new Grape();
                break;
            case BANANA:
                fruit = new Banana();
                break;
        }
        return fruit;

    }


}

